package IBBB.model;

import server.Word;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class WordsMessage {
    private List<Word> wordList = new ArrayList<>();

    public final int getCount() {
        return count;
    }

    public boolean isFinished() {
        return count == wordList.size();
    }
    private int count = 0;

    public List<Word> getWordList() {
        return wordList;
    }

    public WordProperty getWordProperty() {
        return wordProperty;
    }

    private WordProperty wordProperty;

    public WordsMessage(Map<String, Word> words) {
        for (Map.Entry<String, Word> item: words.entrySet()) {
            wordList.add(item.getValue());
        }

        wordProperty = new WordProperty(wordList.get(0));
        count++;
    }

    public void nextWord() {
        wordProperty.setWord(wordList.get(count));
        count++;
    }
}
